﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FtpWorkerRole.FtpServer;

namespace FtpWorkerRole.FtpCommand
{
    public class PwdCommand : CommandBase
    {
        public PwdCommand(FtpSocketHandler handler)
            : base(handler)
        {
            commandName = "PWD";
        }

        public override void execute(string value)
        {
            if (!handler.Login)
            {
                Utils.sendMessage(handler.getSocket(), formatMessage(530, "Please Login!"));
                return;
            }
            string path = handler.currentDirectory.Replace("\\", "/");
            Utils.sendMessage(handler.getSocket(), formatMessage(257, "\""+path+"\""));
        }
    }
}
